//: initialization/E04_OverloadedConstructor.java
/****************** Exercise6 4 *****************
 * Add an overloaded constructor to Exercise6 3 that
 * takes a String argument and prints it along with 
 * your message.
 ***********************************************/
package java_thinking.unit_5._5_4;

public class E04_OverloadedConstructor {
  E04_OverloadedConstructor() {
    System.out.println("Default constructor");
  }
  E04_OverloadedConstructor(String s) {
    System.out.println("String arg constructor");
    System.out.println(s);
  }
  void printTest(){
    //this("ss"); 在方法里面编译器是不允许调用构造器的，只有在构造器里面才能调用
  }
  public static void main(String args[]) {
    // Call default version:
    new E04_OverloadedConstructor();
    // Call overloaded version:
    new E04_OverloadedConstructor("Overloaded");
  }
} /* Output:
Default constructor
String arg constructor
Overloaded
*///:~
